package excp;


import java.io.FileOutputStream;
import java.io.PrintStream;


class ExTest7 {
	public static void main(String st[]){
		try{
			new Hello().show();
		}catch (Exception e) {
			System.out.println(e);
			System.out.println("------");
			System.out.println(e.getMessage());
			e.printStackTrace();
			try{
				PrintStream ps=new PrintStream(new FileOutputStream("exc.txt"));
				e.printStackTrace();
			}catch (Exception e1) {
				System.out.println(e1);
			}
		}
	}
}

class Hello{
	void show(){
		new A().m1();
	}
}
class A{
	void m1(){
		new B().m2();
	}
}
class B{
	void m2(){
		new C().m3();
	}
}
class C{
	void m3(){
		new D().m4();
	}
}
class D{
	void m4(){
		System.out.println("m4 in D class");
		int mn=13/0;
		System.out.println("m4 in D after Exception");
	}
}